VERSION 5.00
Begin VB.Form frmAsigCategorias 
   Caption         =   "Asignar Categorias"
   ClientHeight    =   7260
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   8400
   LinkTopic       =   "Form1"
   ScaleHeight     =   10950
   ScaleWidth      =   20250
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command4 
      Caption         =   "Eliminar"
      Height          =   495
      Left            =   3480
      TabIndex        =   16
      Top             =   6480
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Left            =   1440
      TabIndex        =   15
      Top             =   2520
      Width           =   1695
   End
   Begin VB.ListBox List2 
      Height          =   1230
      Left            =   720
      TabIndex        =   12
      Top             =   5040
      Width           =   7335
   End
   Begin VB.CommandButton Command3 
      Caption         =   "Salir"
      Height          =   495
      Left            =   5040
      TabIndex        =   11
      Top             =   6480
      Width           =   1215
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Omitir"
      Height          =   495
      Left            =   2040
      TabIndex        =   10
      Top             =   6480
      Width           =   1215
   End
   Begin VB.CheckBox Check1 
      Caption         =   "Se Recepciona"
      Height          =   375
      Left            =   4920
      TabIndex        =   8
      Top             =   2040
      Width           =   1455
   End
   Begin VB.ListBox List1 
      Height          =   1230
      Left            =   720
      TabIndex        =   7
      Top             =   3120
      Width           =   7335
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Siguiente"
      Height          =   495
      Left            =   600
      TabIndex        =   5
      Top             =   6480
      Width           =   1215
   End
   Begin VB.ComboBox Combo1 
      Height          =   315
      Left            =   720
      TabIndex        =   4
      Top             =   2040
      Width           =   3975
   End
   Begin VB.Label Label8 
      Caption         =   "Precio:"
      Height          =   255
      Left            =   720
      TabIndex        =   14
      Top             =   2520
      Width           =   1215
   End
   Begin VB.Label Label7 
      BackColor       =   &H00E0E0E0&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "Precios"
      Height          =   255
      Left            =   720
      TabIndex        =   13
      Top             =   4800
      Width           =   7335
   End
   Begin VB.Label Label6 
      Caption         =   "Label6"
      Height          =   255
      Left            =   720
      TabIndex        =   9
      Top             =   1080
      Width           =   495
   End
   Begin VB.Label Label5 
      BackColor       =   &H00E0E0E0&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "Valores"
      Height          =   255
      Left            =   720
      TabIndex        =   6
      Top             =   2880
      Width           =   7335
   End
   Begin VB.Label Label4 
      Caption         =   "Categoria"
      Height          =   495
      Left            =   720
      TabIndex        =   3
      Top             =   1800
      Width           =   1215
   End
   Begin VB.Label Label3 
      BackColor       =   &H00FFFFFF&
      Height          =   255
      Left            =   720
      TabIndex        =   2
      Top             =   1440
      Width           =   5775
   End
   Begin VB.Label Label2 
      Caption         =   "Examen"
      Height          =   495
      Left            =   1440
      TabIndex        =   1
      Top             =   1080
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "Asignar Categoria"
      Height          =   495
      Left            =   720
      TabIndex        =   0
      Top             =   240
      Width           =   1215
   End
End
Attribute VB_Name = "frmAsigCategorias"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs As DAO.Recordset
Sub Guardar()
   Dim tabla As DAO.Recordset
   g = CualGrupo(Combo1.Text)
   s = Check1.Value = 1
    Set tabla = Base.OpenRecordset("examenes")
   tabla.Index = "primarykey"
   tabla.Seek "=", Label6.Caption
   If Not tabla.NoMatch Then
       tabla.Edit
         tabla("recepcion") = s
         tabla("IdGrupo") = g
       tabla.Update
       Dim t As DAO.Recordset
       Set t = Base.OpenRecordset("precios")
       If Text1.Text <> "" Then
       t.Index = "primarykey"
       t.Seek "=", Label6.Caption, "NORMAL"
       If t.NoMatch Then
        t.AddNew
       Else
        t.Edit
       End If
            t(0) = Label6.Caption
            t(1) = "NORMAL"
            t(2) = Val(Text1.Text)
        t.Update
       End If
   End If
    Combo1.Text = "QUIMICA SANGUINEA"

End Sub
Sub mostrar(rs As DAO.Recordset)
On Error Resume Next
If rs.EOF Then Exit Sub
    Label6.Caption = rs(0)
    Label3.Caption = rs(1)
    Dim t As DAO.Recordset
    Set t = Base.OpenRecordset("select *from valores where cod_Examen = " & rs(0))
    List1.Clear
    While Not t.EOF
        List1.AddItem t(1)
        t.MoveNext
    Wend
    Set t = Base.OpenRecordset("select *from precios where cod_Examen = " & rs(0))
    List2.Clear
    Check1.Value = 0
    While Not t.EOF
        Check1.Value = 1
        
        List2.AddItem t(1) & " Bs. " & t(2)
        t.MoveNext
    Wend
End Sub

Private Sub Command1_Click()

    Guardar
    If Not rs.EOF Then
        rs.MoveNext
        mostrar rs
    End If
    Combo1.Text = "QUIMICA SANGUINEA"
    
End Sub

Private Sub Command2_Click()

    If Not rs.EOF Then
        rs.MoveNext
        mostrar rs
    End If
    Combo1.Text = "QUIMICA SANGUINEA"

End Sub

Private Sub Command3_Click()
    Unload Me
End Sub

Private Sub Command4_Click()
    Base.Execute "delete from examenes where cod_examen=" & Val(Label6.Caption)
    Command2_Click
End Sub

Private Sub Form_Load()
    Set rs = Base.OpenRecordset("select *from examenes where idgrupo=0 order by descripcion")
    LlenarCombo Combo1, "select descripcion from grupo order by descripcion"
    mostrar rs
    Combo1.Text = "QUIMICA SANGUINEA"

End Sub
